package com.samphanie.auiu.common.dto;

import com.samphanie.auiu.common.constants.AuiuConstants;
import com.samphanie.auiu.common.validation.ValidEmail;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Set;

/**
 * @author ZSY
 * @email 1451691457@qq.com
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CreateUserDto implements Serializable {
    private static final long serialVersionUID = -7862256976299275899L;

    @NotNull
    @Pattern(regexp = AuiuConstants.PATTERN_USERNAME)
    private String username;

    @NotNull
    @Size(min = 1, max = 50)
    private String nickname;

    private String avatar;

    @ValidEmail
    @NotNull
    @Size(min = 1)
    private String email;

    @Pattern(regexp = AuiuConstants.PATTERN_MOBILE)
    @NotNull
    private String mobile;

    @Builder.Default
    @NotNull
    private boolean usingMfa = true;

    @Builder.Default
    @NotNull
    private boolean enabled = true;

    @NotEmpty
    private Set<Long> roles;

    private Integer gender;
    private String note;
    private String city;
    private String source;
}
